feat: add background update check and self-update command#91
Open
feat: add background update check and self-update command#91
Conversation
The install script now defaults to ~/.local/bin instead of /usr/local/bin when running as a non-privileged user, avoiding the need for sudo. The sudo fallback has been removed; if the target directory is not writable, the script errors with a clear message instead. The PATH check and warning are now shown on all platforms, not just Windows. When RICOCHET_INSTALL_DIR is set, that value is still respected. When running as root, /usr/local/bin is still the default. Closes #86
Add a periodic background update check that queries the GitHub Releases API every 24 hours and notifies the user via stderr when a new version is available. Add a `ricochet self-update` command that downloads and replaces the running binary with the latest release. Key behaviors: - Background check runs on all platforms; skipped for Homebrew installs (/opt/homebrew) and when RICOCHET_NO_UPDATE_CHECK is set - After 3 consecutive GitHub API failures, update checks are automatically disabled via skip_update_check in config.toml, with a stderr notice explaining the change - `ricochet self-update` re-enables checks if they were auto-disabled - Uses self-replace crate for cross-platform atomic binary replacement (handles Windows file locking) - macOS downloads from S3 (Homebrew bottle format), Linux/Windows from GitHub Releases - Release notes link shown after updating
2a8f653 to
0fca588
Compare
d50eabd to
50963e9
Compare
Member
Author
|
@JosiahParry Would be cool to get this into 0.4.0 so users can start with that feature right away instead of having to download another static version that ship with that - but I am also OK to postpone it to the next version. I just would like to release a new version with the auth fixes latest tomorrow :) |
Member
|
I agree—but I’ve got some hesitation with the version checks not using semver and the const for max checks since IIUC (and very may well not) the binary is invoked fresh each command so that will never exceed 1. I’m just lacking bandwidth to give it the full review atm |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
@JosiahParry The main goal here is to make it easier for Windows/Linux users to update the CLI without having to search for the install command again.
With normal access to GH, this should just work OOB via
ricochet self-update.For systems without outbound access, a smart detection feature is included that stops these checks after a specific time as they are meaningless anyway.
Summary
ricochet self-updatecommand that downloads and replaces the running binary with the latest GitHub releaseskip_update_checkconfig flag/opt/homebrew/bin) and whenRICOCHET_NO_UPDATE_CHECKis setricochet self-updatere-enables checks if they were auto-disabled, resets failure counter, and shows release notes link